package com.hades.example.java.refactoring.after.c11.c11_10_form_template_method;

public abstract class Statement {
    // 以ASCII 码打印报表
    // Template Method(模版函数)
    public String value(Customer customer) {
        String result = headerString(customer);
        for (Rental each : customer.getRentals()) {
            //show figures for this rental
            result += eachRentalString(each);
        }
        //add footer lines
        result += footerString(customer);
        return result;
    }

    abstract String headerString(Customer customer);

    abstract String eachRentalString(Rental each);

    abstract String footerString(Customer customer);
}